// pages/my/collections/collections.js
import {
  requestUtil
} from "../../../utils/requestUtil"
Page({

  /**
   * 页面的初始数据
   */
  data: {
    collectionList:[],
    userId:0,
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    let user = wx.getStorageSync('user')
    if(user!=null){
      this.setData({
        userId:user.userId
      })
    }

  },
  onShow(){
    this.getCollectionList()

  } ,
  async getCollectionList(){
    const result = await requestUtil({
      url: '/recipe/getCollectionsByUserId/'+this.data.userId,
      method: 'GET'
    });
    this.setData({
      collectionList: result.data,
    })
    
  },
})